USE Liberty
GO

-- ------------------------------------------------------------------------------------------------
-- Addresses Table Create Script
-- ------------------------------------------------------------------------------------------------
SET NOCOUNT OFF
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET QUOTED_IDENTIFIER ON
SET NUMERIC_ROUNDABORT OFF
GO

PRINT 'Creating Table dbo.Addresses...'
GO

IF OBJECT_ID('dbo.Addresses', 'U') IS NULL
BEGIN
	CREATE TABLE dbo.Addresses
	(OID				bigint		IDENTITY(1, 1)	NOT NULL
	,Version			rowversion
	,Address1			varchar(128)				NOT NULL
	,Address2			varchar(128)					NULL
	,City				varchar(128)				NOT NULL
	,State				varchar(128)				NOT NULL
	,PostalCode			varchar(30)						NULL
	,Country			varchar(128)				NOT NULL

	,UpdatedDate		datetime					NOT NULL
		CONSTRAINT DFLT_Addresses_UpdatedDate DEFAULT GETDATE()
	,CreatedDate		datetime					NOT NULL
		CONSTRAINT DFLT_Addresses_CreatedDate DEFAULT GETDATE()

	,CONSTRAINT PK_Addresses PRIMARY KEY CLUSTERED( OID ) --ON PRIMARY

	)

	PRINT 'Table dbo.Addresses has been created successfully.'

END
ELSE 
BEGIN
    PRINT 'Table dbo.Addresses already exists.'
END

GO
